{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "from tkinter import *\n",
    "import time\n",
    "root = Tk()\n",
    "\n",
    "time1 = ''\n",
    "clock = Label(root, font=('times', 30, 'bold'), bg='blue')\n",
    "\n",
    "clock.pack(fill=BOTH, expand=1)\n",
    "\n",
    "def tick():\n",
    "    global time1\n",
    "    \n",
    "    # get the current local time from the PC\n",
    "    time2 = time.strftime('%H:%M:%S')\n",
    "\n",
    "    # if time string has changed, update it\n",
    "    if time2 != time1:\n",
    "        time1 = time2\n",
    "        clock.config(text=time2)\n",
    "    \n",
    "    # calls itself every 200 milliseconds\n",
    "    # to update the time display as needed\n",
    "    clock.after(200, tick)\n",
    "\n",
    "tick()\n",
    "root.mainloop()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
